﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Prism.WebBuilder.Processors.Base;
using Prism.WebBuilder.Lib.Cui;

namespace Prism.WebBuilder.Processors
{
	public class Execute: ProcessorBase
	{
		private string _objName;
		public Execute Init(string name)
		{
			_objName = name;
			Process();
			return this;
		}
		public override void Process()
		{
			IObject obj = GetObject(_objName);
			if (obj is ProcessorBase)
				(obj as ProcessorBase).Process();
			else if (obj == null)
			{
				Cui.Error("Can't find object {0}", _objName);
			}
			else
			{
				Cui.Error("Object {0} is not executable", _objName);
			}
			base.Process();
		}
	}
}
